DECLARE @Id Int                                                     
Select @Id = Id From sysobjects Where Name = 'IHIOPrescriptionDetail'
IF not Exists(SELECT * FROM syscolumns WHERE id = @Id and Name = 'RowIndex')
  Alter Table IHIOPrescriptionDetail Add RowIndex INT ;